<template>
	<view>
		<u-navbar :title="title"></u-navbar>
		<u-cell-group>
			<u-cell-item :title="project.projectName" v-for="(project,index) in projects" :key="index"
				@click="tapDetail(project.projectId)">
			</u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
	export default {
		//��
		async onLoad() {
			var [err, res] = await this.$to(this.$api.get({
				url: "/userinfo/projects"
			}));
			this.projects = res.data;
		},
		data() {
			return {
				projects: [],
				title: "选择项目"
			}
		},
		methods: {
			tapDetail(projectId) {
				const eventChannel = this.getOpenerEventChannel();
				eventChannel.emit('choosProject', projectId);
				uni.navigateBack();
			}
		}
	}
</script>

<style>
</style>
